package com.tbit.uqbike.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 对账差异类型
 *
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/6/6
 */
@AllArgsConstructor
@NoArgsConstructor
@Getter
public enum UnBalanceTypeEnum {

    //金额不一致
    AMOUNT_UNBALANCE("AMOUNT_UNBALANCE", "金额不一致"),

    //状态不一致
    STATUS_UNBALANCE("STATUS_UNBALANCE", "状态不一致"),

    //源数据单边
    SOURCE_UNILATERAL("SOURCE_UNILATERAL", "源数据单边"),

    //目标数据单边
    TARGET_UNILATERAL("TARGET_UNILATERAL", "目标数据单边"),

    //跨天
    CROSS_DAY("CROSS_DAY", "跨天");

    private String code;

    private String desc;

    public static UnBalanceTypeEnum getByCode(String code) {
        for (UnBalanceTypeEnum value : UnBalanceTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static UnBalanceTypeEnum getByDesc(String desc) {
        for (UnBalanceTypeEnum value : UnBalanceTypeEnum.values()) {
            if (value.getDesc().equals(desc)) {
                return value;
            }
        }
        return null;
    }


    public static String getDescByCode(String code) {
        for (UnBalanceTypeEnum value : UnBalanceTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getDesc();
            }
        }
        return null;
    }

    public static String getCodeByDesc(String desc) {
        for (UnBalanceTypeEnum value : UnBalanceTypeEnum.values()) {
            if (value.getDesc().equals(desc)) {
                return value.getCode();
            }
        }
        return null;
    }



}
